<template>
	<view class="notice" v-if="show">
		<view class="body">
			<image mode="widthFix" :src="item.url">
			</image>
			<view class="text-center " @click="closeGo">
				<iconfont color="#fff" size="45" icon="icon-shibai"  />
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNotice
	} from '../../api/home';

	export default {
		data() {
			return {
				show: false,
				item: {}
			}
		},
		mounted() {

			var the = this
			getNotice().then(res => {
				//ids.push(res.id);
				//uni.setStorageSync("notices", ids.join(","))
				//console.log("getNotice:", res)
				the.item = res;
				the.show = true
			}).catch(e => {
				the.show = false
			})
		},
		methods: {
			closeGo: function() {
				console.log("hhhhh")
				let res=this.item
				let ids = uni.getStorageSync("notices") | null
				if (ids != null) {
					ids = []
				}
				this.show = false
				ids.push(res.id);
				uni.setStorageSync("notices", ids.join(","))
				console.log("getNotice:", res)

			}
		}
	}
</script>

<style lang="scss">
	.notice {
		width: 100%;
		height: 100%;
		background-color: #00000070;
		position: fixed;
		z-index: 9999;

		.body {

			width: 80%;
			margin: 0 auto;
			margin-top: 40%;
		}
	}
</style>